//--------------------------------------- NOTES ------------------------------------------------------//
* This table is Table A9 in the paper 
//--------------------------------------------------------------------------------------------------------//

cd  "/YOUR_LOCAL_DIRECTORY" //setting the working directory
clear all //remove all data, labels, matrices etc (incl. Mata functions)
use game_state_pilot_data.dta, clear

* Create the key treatment variable
gen byte status_quo = treatment=="status_quo"
la var status_quo  "Status Quo"

* Create Y variable
gen byte offer_rate = player1action=="Offer" 

** Missed opportunity
gen byte missedopportunity = player1bluecount>player2lowbluecount & player1action!="Offer" 
replace missedopportunity = 1 if player1bluecount>player2highbluecount & player1action!="Offer" 

* Make table (components)

* Make table (Pilot 1)
eststo clear

eststo: quietly reg offer_rate status_quo if pilot==1,  vce(cluster room) // Compare kidney recovery rate (jar offer rate) by treatment group
eststo: quietly reg offer_rate status_quo if player1jartype=="low_quality" & pilot==1,  vce(cluster room)  // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg offer_rate status_quo if player1jartype=="high_quality" & pilot==1,  vce(cluster room)   // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being HIGH quality

eststo: quietly reg missedopportunity status_quo if pilot==1,  vce(cluster room) // Compare missed opportunity rate by treatment group
eststo: quietly reg missedopportunity status_quo if player1jartype=="low_quality" & pilot==1,  vce(cluster room)  // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg missedopportunity status_quo if player1jartype=="high_quality" & pilot==1,  vce(cluster room)   // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being HIGH quality

esttab using table_recoveryrate_pilot1_a9.tex, se r2  keep(status_quo _cons) star(+ 0.1 * 0.05 ** 0.01)

* Make table (Pilot 2)
eststo clear

eststo: quietly reg offer_rate status_quo if pilot==2,  vce(cluster room) // Compare kidney recovery rate (jar offer rate) by treatment group
eststo: quietly reg offer_rate status_quo if player1jartype=="low_quality" & pilot==2,  vce(cluster room)  // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg offer_rate status_quo if player1jartype=="high_quality" & pilot==2,  vce(cluster room)   // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being HIGH quality

eststo: quietly reg missedopportunity status_quo if pilot==2,  vce(cluster room) // Compare missed opportunity rate by treatment group
eststo: quietly reg missedopportunity status_quo if player1jartype=="low_quality" & pilot==2,  vce(cluster room)  // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg missedopportunity status_quo if player1jartype=="high_quality" & pilot==2,  vce(cluster room)   // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being HIGH quality

esttab using table_recoveryrate_pilot2_a9.tex, se r2  keep(status_quo _cons) star(+ 0.1 * 0.05 ** 0.01)

* Make table (Pilot 3)
eststo clear

eststo: quietly reg offer_rate status_quo if pilot==3,  vce(cluster room) // Compare kidney recovery rate (jar offer rate) by treatment group
eststo: quietly reg offer_rate status_quo if player1jartype=="low_quality" & pilot==3,  vce(cluster room)  // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg offer_rate status_quo if player1jartype=="high_quality" & pilot==3,  vce(cluster room)   // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being HIGH quality

eststo: quietly reg missedopportunity status_quo if pilot==3,  vce(cluster room) // Compare missed opportunity rate by treatment group
eststo: quietly reg missedopportunity status_quo if player1jartype=="low_quality" & pilot==3,  vce(cluster room)  // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg missedopportunity status_quo if player1jartype=="high_quality" & pilot==3,  vce(cluster room)   // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being HIGH quality

esttab using table_recoveryrate_pilot3_a9.tex, se r2  keep(status_quo _cons) star(+ 0.1 * 0.05 ** 0.01)

* Make table (Pilot 4)
eststo clear

eststo: quietly reg offer_rate status_quo if pilot==4,  vce(cluster room) // Compare kidney recovery rate (jar offer rate) by treatment group
eststo: quietly reg offer_rate status_quo if player1jartype=="low_quality" & pilot==4,  vce(cluster room)  // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg offer_rate status_quo if player1jartype=="high_quality" & pilot==4,  vce(cluster room)   // Compare kidney recovery rate (jar offer rate) by treatment group, CONDITIONAL on jar being HIGH quality

eststo: quietly reg missedopportunity status_quo if pilot==4,  vce(cluster room) // Compare missed opportunity rate by treatment group
eststo: quietly reg missedopportunity status_quo if player1jartype=="low_quality" & pilot==4,  vce(cluster room)  // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being LOW quality
eststo: quietly reg missedopportunity status_quo if player1jartype=="high_quality" & pilot==4,  vce(cluster room)   // Compare missed opportunity rate by treatment group, CONDITIONAL on jar being HIGH quality

esttab using table_recoveryrate_pilot4_a9.tex, se r2  keep(status_quo _cons) star(+ 0.1 * 0.05 ** 0.01)
